﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace esimerkki
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        Henkilö[] porukka;
        int laskuri = 0;
        public MainWindow()
        {
            InitializeComponent();
            porukka = esimerkki.TestiHenkilöt.AnnaKolmeHenkilöä();
            MyGrid.DataContext = porukka;
           
        }

        private void btnForward_Click(object sender, RoutedEventArgs e)
        {
            if (laskuri == 2) { laskuri = -1; }
            laskuri++;
            MyGrid.DataContext = porukka[laskuri];
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            if (laskuri == -0) { laskuri = 3; }
            laskuri--;
            MyGrid.DataContext = porukka[laskuri];
        }
    }
}
